package com.zyw.security.shiro.web.authc.tk;

/**
 * 短信登录认证token
 *
 * @author zhangyw
 * @date 2018/1/25 9:17
 */
public class SmsAuthcToken extends BasicAuthcToken {

    private String phone; // 手机号

    private String code; // 短信验证码

    public SmsAuthcToken() {
    }

    public SmsAuthcToken(String phone, String code) {
        this(phone, code, null);
    }

    public SmsAuthcToken(String phone, String code, String host) {
        this.phone = phone;
        this.code = code;
        this.setHost(host);
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public Object getPrincipal() {
        return getPhone();
    }

    @Override
    public Object getCredentials() {
        return getCode();
    }
}
